import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import vueJsx from "@vitejs/plugin-vue-jsx";
import qiankun from "vite-plugin-qiankun";
import path from "path";

export default defineConfig({
  plugins: [vue(), vueJsx(), qiankun("main-app", { useDevMode: true })],
  resolve: {
    alias: {
      "@": path.resolve(__dirname, "src"),
    },
    preserveSymlinks: true,
    modules: [
      path.resolve(__dirname, "node_modules"),
      path.resolve(__dirname, "../../node_modules"),
    ],
  },
  server: {
    port: 8080,
    open: true,
    cors: true,
  },
  // 确保 CSS 解析正常（Vite 默认支持，无需额外配置）
  css: {
    preprocessorOptions: {
      scss: {
        // 如果使用 SCSS，可以添加全局变量
        // additionalData: `@import "@/assets/styles/variables.scss";`
      },
    },
  },
});
